﻿<UserControl x:Class="Microsoft.Forums.ForumsClient.Views.OptionsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:ForumsClient="clr-namespace:Microsoft.Forums.ForumsClient"
    xmlns:Views="clr-namespace:Microsoft.Forums.ForumsClient.Views"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Background="{DynamicResource DefaultWindowBackground}">
    <UserControl.Resources>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <GroupBox Grid.Row="0" HorizontalAlignment="Stretch" BorderBrush="{DynamicResource DefaultBorder}" Margin="5">
            <GroupBox.Header>
                <Label Grid.Row="0" FontSize="14" FontWeight="Bold" Content="Set Synchronization Preferences" />
            </GroupBox.Header>
            <Grid  Margin="5" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition  Height="Auto"/>
                </Grid.RowDefinitions>

                <Grid Grid.Row="1" HorizontalAlignment="Stretch"  Margin="0,10">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <!-- Post Header/Body download preference -->
                    <CheckBox Name="PostDownloadPreferenceCheckBox" 
                          Margin="5"
                          IsChecked="{Binding Path=IsHeaderOnlyModeSet}" 
                          Grid.Row="0" 
                          Content="Download Post Headers Only" 
                          ToolTip="Check this box to stop download of post bodies in addition to the headers - Feature is not yet implemented"
                          IsEnabled="False"
                         />
                </Grid>


                <Grid Grid.Row="0" HorizontalAlignment="Stretch" Margin="0,5">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <CheckBox Name="AutoSynchPreferenceCheckBox" 
                          IsChecked="{Binding Path=IsAutoSynchModeSet}" 
                          Grid.Row="0" Grid.Column="0" 
                          Content="Automatically Synchronize Forums" 
                          ToolTip="Uncheck this box to stop automatic synschronization of forums"
                          Height="25" Margin="5,15,5,5"
                          />

                    <ComboBox Grid.Row="0" Grid.Column="1"  
                          IsSynchronizedWithCurrentItem="True" 
                          IsEnabled="{Binding Path=IsAutoSynchModeSet}" 
                          MinWidth="50" Margin="5" 
                          Height="25" 
                          SelectedIndex="-1"
                          ItemsSource="{Binding Path=SyncFrequencyCollectionView}"                         
                          Name="SynchSettingsComboBox" >
                    </ComboBox>
                </Grid>

                <!-- Auto Expiration Preference -->
                <Grid Grid.Row="2" HorizontalAlignment="Stretch" Margin="0,5">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Label Grid.Row="0" Grid.Column="0" Height="25" Margin="15,0,5,0" Name="AutoExpirationDaysLabel" Content="When should threads auto exipre" ToolTip="Number of days with no activity before thread is automatically deleted from local data storage" IsEnabled="False" />
                    <ComboBox x:Uid="AutoExpireDaysComboBox"  
                          Grid.Row="0" Grid.Column="1"
                          IsSynchronizedWithCurrentItem="True" 
                          MinWidth="50" Margin="5" Height="25" 
                          Name="AutoExpireDaysComboBox" 
                          SelectedIndex="-1"
                          ItemsSource="{Binding Path=PostAutoExpireAgeCollectionView}"
                          ToolTip="Select the number of days with no activity before thread is automatically deleted from local data storage - Feature is not yet implemented"
                          IsEnabled="False"
                          >
                    </ComboBox>
                </Grid>
            </Grid>
        </GroupBox>
        
        <StackPanel Grid.Row="1" VerticalAlignment="Bottom">
            <StackPanel Orientation="Horizontal"  HorizontalAlignment="Right" >
                <Button Name="Save" IsDefault="True" Content="Save" Width="50" ToolTip="Saves settings and exits" Command="{x:Static ForumsClient:Commands.SaveOptionsSettings}" />
                <Button Name="Cancel" IsCancel="True" Width="50" Content="Cancel" ToolTip="Exits without saving settings" Command="Close" />
            </StackPanel>
        </StackPanel>
    </Grid>
</UserControl>
